import { CustomI18NITF } from '@INTERFACES/Common'
import { SurveyITF } from '@INTERFACES/Survey'
import { RoundType } from '@CONSTANTS/medRecord'

export enum MedRecordPart {
  PatientProfile = 'PatientProfile',
  Condition = 'Condition',
}

export enum MedRecordStatus {
  New = 'New',
  Draft = 'Draft',
  ReadyForSubmit = 'ReadyForSubmit',
  Submitted = 'Submitted',
  SurveyDone = 'SurveyDone',
  Archived = 'Archived',
}

export enum FieldStyle {
  TextMultiLang = 'TextMultiLang',
  SingleChoiceGender = 'SingleChoiceGender',
  Number = 'Number',
  PersonalId = 'PersonalId',
  PhoneNumber = 'PhoneNumber',
  SingleChoice = 'SingleChoice',
  Text = 'Text',
  DateOnly = 'DateOnly',
  IncrementalNumber = 'IncrementalNumber',
  UploadedFilePreviewUpload = 'UploadedFilePreviewUpload',
  MultipleChoice = 'MultipleChoice',
  VASRating = 'VASRating',
  HourMinute = 'HourMinute',
  Boolean = 'Boolean',
  ShrinkBoolean = 'ShrinkBoolean',
  ShrinkTwo = 'ShrinkTwo',
  ShrinkThree = 'ShrinkThree',
}

interface MedRecordITF {
  Part: keyof typeof MedRecordPart;
  PatientId: string;
  Status: MedRecordStatus;
  Surveys: SurveyITF[];
  p8Id: string;
  Round: RoundType | string;
  Fields: {
    Survey: SurveyITF[]
    [key: string]: string | any[];
  },
}

export interface MedRecordQuestion {
  FieldStyle: FieldStyle;
  FieldText: string;
  FieldGroup: string;
  FieldName: string;
  HintText: string;
  FieldValue?: string | any;
  FieldOtherText?: string;
  OtherText?: string;
  Dependency: Record<string, any>;
  Default?: number;
  Unit?: string;
  Options: { [key in string]: { DisplayText: CustomI18NITF } }
  Children: MedRecordQuestion[];
  CharLimit?: number;
  Source: string;
}

export interface MedRecordDetail {
  MedRecord: MedRecordITF;
  MedRecordQuestion: {
    PersonalInfo: MedRecordQuestion[],
    VisitorInfo: MedRecordQuestion[],
    ConditionInfo: MedRecordQuestion[],
  }
}
